<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('变更通讯费记录列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 100px;">SN编号：</label>
                                <input type="text" name="machineNum"/>
                            </li>
                            <li>
                                <label style="width: 100px;">终端类型：</label>
                                <select name="posType" th:with="type=${@dict.getType('terminal_type')}">
                                    <option value="">请选择</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label style="width: 100px;">激活状态：</label>
                                <select name="activateStatus">
                                    <option value="">所有</option>
                                    <option value="1">已激活</option>
                                    <option value="2">未激活</option>
                                </select>
                            </li>
                            <li>
                                <label style="width: 100px;">录入日期：</label>
                                <input type="text" class="time-input" style="display: inline-block" placeholder="开始时间" readonly name="start"/>
                                ——
                                <input type="text" class="time-input" style="display: inline-block" placeholder="结束时间" readonly name="end"/>
                            </li>
                            <li>
                                <label style="width: 100px;">返现服务商编号：</label>
                                <input type="text" name="returnAgentNum"/>
                            </li>
                            <li>
                                <label style="width: 100px;">返现服务商名称：</label>
                                <input type="text" name="returnAgentName"/>
                            </li>
                            <li>
                                <label style="width: 100px;">商户编号：</label>
                                <input type="text" name="merno"/>
                            </li>
                            <li>
                                <label style="width: 100px;">资深总监编号：</label>
                                <input type="text" name="zsAgentNum"/>
                            </li>
                            <li>
                                <label style="width: 100px;">资深总监名称：</label>
                                <input type="text" name="zsAgentName"/>
                            </li>
                            <li>
                                <label style="width: 100px;">收取时间：</label>
                                <input type="text" class="time-input" style="display: inline-block" placeholder="开始时间" readonly name="start1"/>
                                ——
                                <input type="text" class="time-input" style="display: inline-block" placeholder="结束时间" readonly name="end1"/>
                            </li>
                            <li>
                                <label style="width: 30px;"></label>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="terminal:changeFeeRecord:add">
                    <i class="fa fa-plus"></i> 配置通讯费
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="terminal:changeFeeRecord:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" class="table text-nowrap"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('terminal:changeFeeRecord:edit')}]];
        var removeFlag = [[${@permission.hasPermi('terminal:changeFeeRecord:remove')}]];
        var prefix = ctx + "terminal/changeFeeRecord";
        var terminalTypeDatas = [[${@dict.getType('terminal_type')}]];

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "变更通讯费记录",
                firstLoad:false,
                clickToSelect:true,
                columns: [{
                    checkbox: true
                },
                {
                    field: 'sysId',
                    title: '系统编号'
                },
                {
                    field: 'machineNum',
                    title: 'SN编号'
                },
                {
                    field: 'posno',
                    title: '终端号'
                },
                {
                    field: 'posType',
                    title: '终端类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(terminalTypeDatas, value);
                    }
                },
                {
                    field: 'oldSimFee',
                    title: '原流量卡费'
                },
                {
                    field: 'nowSimFee',
                    title: '流量卡费 (元)'
                },
                {
                    field: 'returnAgentNum',
                    title: '返现服务商编号'
                },
                {
                    field: 'returnAgentName',
                    title: '返现服务商名称'
                },
                {
                    field: 'activateStatus',
                    title: '激活状态',
                    formatter: function (value, row, index) {
                        switch (value){
                            case '1': return '<span style="color:green;">已激活</span>';break;
                            case '2': return '<span style="color:red;">未激活</span>';break;
                        }
                    }
                },
                {
                    field: 'merno',
                    title: '商户编号'
                },
                {
                    field: 'merName',
                    title: '商户名称'
                },
                {
                    field: 'addDate',
                    title: '录入日期'
                },
                {
                    field: 'collDate',
                    title: '收取时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="rem(\'' + row.sysId + '\',\'' + row.posno + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function rem(sysId,posno){
            $.modal.confirm("确定删除该条" + table.options.modalName + "信息吗？", function() {
                var data = {"sysId": sysId, "posno": posno};
                $.operate.submit(prefix + "/remove", "post", "json", data);
            });
        }
    </script>
</body>
</html>